home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Info 1994 March
/
Internet Info CD-ROM (Walnut Creek) (March 1994).iso
/
networking
/
ip
/
ppp
/
ppp-sunos4.1.pl6.mem_leak.patch
< prev
next >
Wrap
Text File
|
1992-01-09
|
2KB
|
89 lines
*** ppp.c.old Thu Jan 9 17:16:46 1992
--- ppp.c Thu Jan 9 17:16:40 1992
***************
*** 839,845 ****
void io()
{
int len, i;
! u_char *p;
u_short protocol;
#ifdef STREAMS
struct strbuf str;
--- 839,845 ----
void io()
{
int len, i;
! u_char *p, *pstart;
u_short protocol;
#ifdef STREAMS
struct strbuf str;
***************
*** 850,855 ****
--- 850,856 ----
for (;;) { /* Read all available packets */
p = (u_char *) malloc(MTU + DLLHEADERLEN);
+ pstart = p; /* save start of packet */
#ifdef STREAMS
str.maxlen = MTU+DLLHEADERLEN;
str.buf = (caddr_t) p;
***************
*** 859,864 ****
--- 860,866 ----
if(errno == EAGAIN || errno == EWOULDBLOCK) {
if(debug > 2)
perror("ppp: getmsg(fd)");
+ free(pstart)
return;
}
perror("ppp: getmsg(fd)");
***************
*** 871,876 ****
--- 873,879 ----
if(debug > 2)
fprintf(stderr, "ppp: getmsg short return length %d\n",
str.len);
+ free(pstart);
return;
}
***************
*** 880,885 ****
--- 883,889 ----
if (errno == EWOULDBLOCK) {
if (debug > 2)
perror("ppp: read(fd)");
+ free(pstart);
return;
}
else {
***************
*** 897,902 ****
--- 901,907 ----
if (len < DLLHEADERLEN) {
if (debug)
fprintf(stderr, "ppp: input: Received short packet.\n");
+ free(pstart);
return;
}
***************
*** 909,915 ****
*/
if (protocol != LCP &&
lcp_fsm[0].state != OPEN) {
! free(p - DLLHEADERLEN);
return;
}
--- 914,922 ----
*/
if (protocol != LCP &&
lcp_fsm[0].state != OPEN) {
! if (debug)
! fprintf(stderr, "ppp: input: Received non-LCP packet and LCP is not in open state.\n");
! free(pstart);
return;
}